package org.zjt.chapter1.http.domain;

import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;

import java.util.function.Consumer;

/**
 * Description:
 *
 * @author juntao.zhang
 * Date: 2018-07-19 下午6:04
 * @see
 */
public class CallBackTextWebSocketFrame extends TextWebSocketFrame {

    private final TextWebSocketFrame textWebSocketFrame;

    private final Consumer<TextWebSocketFrame> consumer ;

    public CallBackTextWebSocketFrame(TextWebSocketFrame textWebSocketFrame, Consumer<TextWebSocketFrame> consumer) {
        this.textWebSocketFrame = textWebSocketFrame;
        this.consumer = consumer;
    }


    public void send() {
        consumer.accept(textWebSocketFrame);
    }

}
